<template>
	<view class="content">
		<view class="box" v-for="(item, index) in dataPool" :key="index" @tap="activeCurrent(index, item.groupid)">
			<view class="box-cont">
				<view class="class_item_left">
					<i class="iconfont iconbanji11"></i>
				</view>
				<view class="center-cont">
					<view class="center-cont-item1">{{item.group_name}}</view>
					<view class="center-cont-item2">
						<text>{{item.nicheng}}</text>
						<text style="margin-left: 30upx;">{{item.count_num}}人</text>
					</view>
				</view>
				<i class="iconfont iconjiantou font-styll"></i>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		components: {
			
		},
		data() {
			return {
				currentList: 0,
				dataPool: [],
				is_exam_type: '',
				student_id: 0,
				grade: ''
			}
		},
		onLoad(e) {
			this.is_exam_type = e.is_exam_type
			this.grade = e.grade;
			this.student_id = uni.getStorageSync("currentChild").student_id
			this._getGroupList()
		},
		methods: {
			activeCurrent(index, groupid) {
				this.currentList = index
				if(this.is_exam_type === '2') {
					uni.redirectTo({
						url: 'practise_task?groupid=' + groupid + '&is_exam_type=' + this.is_exam_type
					})
				} else if (this.is_exam_type === '1') {
					uni.redirectTo({
						url: 'work_type?groupid=' + groupid + '&is_exam_type=' + this.is_exam_type
					})
				} else if (this.is_exam_type === '3') {
					uni.redirectTo({
						url: 'mistake-notes1?groupid=' + groupid + '&student_id=' + this.student_id+'&grade='+this.grade
					})
				}
			},
			_getGroupList() {
				// 获取班级列表
				// 文档：https://www.showdoc.cc/416494108281686?page_id=2512874686517536
				this.$zapi.apiPost('user/Grade.User/GradeList', {
					student_id: this.student_id
				}).then((res) => {
					if(res.data.code == 200) {
						this.dataPool = res.data.data
					}
				})
			}
		}
	}
</script>

<style>
	page{height: 100%;}
	navigator{margin: 0 auto;}
	
	.content {
		height: 100%;
		background-color: #F3F3F3;
		border-top: 1upx solid #F3F3F3;
	}
	
	.box {
		display: flex;
		align-items: center;
		margin-left: auto;
		margin-right: auto;
		width: 690upx;
		height: 160upx;
		margin-top: 20upx;
		background-color: #ffffff;
		border-radius: 30upx;
	}
/* 	.box:nth-child(1) {
		margin-top: 0;
	} */
	.box-cont {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-left: auto;
		margin-right: auto;
		width: 606upx;
	}
	.iconbanji11{
		color: #FF9900;
		font-size: 110upx;
		line-height: 1;
	}
	.center-cont {
		display: flex;
		flex-direction: column;
		justify-content: center;
		position: relative;
		width: 418upx;
		left: 1upx;
		height: 80upx;
	}
	.center-cont-item1 {
		color: #333333;
		font-size: 36upx;
	}
	.center-cont-item2 {
		color: #666666;
		font-size: 32upx;
	}
	.font-styll {
		font-size: 48upx;
		color: #999999;
	}
</style>
